<template>
	<view>
		vuex
	 
		<view class="">
			{{user.name}}
		</view>
		<view class="">
			{{token}}
		</view>
		
		<view class="">
			{{doubleCount}}
		</view>
		
			<button @click="update(1)">++</button>
		
			<button @click="updateToken('kkkkkkkkkkk')">修改token</button>
		
		<button @click="updateUserSync({name:'李四'})">修改User</button>
	</view>
</template>

<script>
	
	//mapState辅助函数,作用:把vuex里state变量映射到组件
	import { mapState,mapGetters,mapActions,mapMutations} from 'vuex';
	export default {
		data() {
			return {
				
			}
		},
		computed:{
			 ...mapState(['user','token']),
			 ...mapGetters(['doubleCount'])
		},
		onLoad() {
	 
		},
		methods: {
			submit(){
				
			},
			...mapMutations(['updateToken','update']),
			...mapActions(['updateUserSync'])
			
		}
	}
</script>

<style>

</style>
